home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / QD3DPick.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  8.0 KB  |  288 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DPick.h                                                 **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Public picking routines                                  **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1992-1997 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14. #ifndef QD3DPick_h
  15. #define QD3DPick_h
  16.  
  17. #include "QD3D.h"
  18. #include "QD3DStyle.h"
  19. #include "QD3DGeometry.h"
  20.  
  21. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  22.     #pragma once
  23. #endif  /*  PRAGMA_ONCE  */
  24.  
  25. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  26.  
  27. #if defined(__xlc__) || defined(__XLC121__)
  28.     #pragma options enum=int
  29.     #pragma options align=power
  30. #elif defined(__MWERKS__)
  31.     #pragma enumsalwaysint on
  32.     #pragma options align=native
  33. #elif defined(__MRC__) || defined(__SC__)
  34.     #if __option(pack_enums)
  35.         #define PRAGMA_ENUM_RESET_QD3DPICK 1
  36.     #endif
  37.     #pragma options(!pack_enums)
  38.     #pragma options align=power
  39. #endif
  40.  
  41. #endif  /* OS_MACINTOSH */
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif  /*  __cplusplus  */
  46.  
  47.  
  48. /*****************************************************************************
  49.  **                                                                            **
  50.  **                            Mask bits for hit information                     **
  51.  **                                                                            **
  52.  *****************************************************************************/
  53.  
  54. typedef enum TQ3PickDetailMasks {
  55.     kQ3PickDetailNone                    = 0,
  56.     kQ3PickDetailMaskPickID             = 1 << 0,
  57.     kQ3PickDetailMaskPath                 = 1 << 1,
  58.     kQ3PickDetailMaskObject             = 1 << 2,
  59.     kQ3PickDetailMaskLocalToWorldMatrix    = 1 << 3,
  60.     kQ3PickDetailMaskXYZ                 = 1 << 4,
  61.     kQ3PickDetailMaskDistance             = 1 << 5,
  62.     kQ3PickDetailMaskNormal             = 1 << 6,
  63.     kQ3PickDetailMaskShapePart             = 1 << 7,
  64.     kQ3PickDetailMaskPickPart             = 1 << 8,
  65.     kQ3PickDetailMaskUV                 = 1 << 9
  66. } TQ3PickDetailMasks;
  67.  
  68. typedef unsigned long TQ3PickDetail;
  69.  
  70.  
  71. /******************************************************************************
  72.  **                                                                             **
  73.  **                                Hitlist sorting                                 **
  74.  **                                                                             **
  75.  *****************************************************************************/
  76.  
  77. typedef enum TQ3PickSort {
  78.     kQ3PickSortNone,
  79.     kQ3PickSortNearToFar,
  80.     kQ3PickSortFarToNear
  81. } TQ3PickSort;
  82.  
  83.  
  84. /******************************************************************************
  85.  **                                                                             **
  86.  **                    Data structures to set up the pick object                 **
  87.  **                                                                             **
  88.  *****************************************************************************/
  89.  
  90. #define kQ3ReturnAllHits        0
  91.  
  92. typedef struct TQ3PickData {
  93.     TQ3PickSort            sort;
  94.     TQ3PickDetail        mask;
  95.     unsigned long        numHitsToReturn;
  96. } TQ3PickData;
  97.  
  98. typedef struct TQ3WindowPointPickData {
  99.     TQ3PickData            data;
  100.     TQ3Point2D            point;
  101.     float                vertexTolerance;
  102.     float                edgeTolerance;
  103. } TQ3WindowPointPickData;
  104.  
  105. typedef struct TQ3WindowRectPickData {
  106.     TQ3PickData            data;
  107.     TQ3Area                rect;
  108. } TQ3WindowRectPickData;
  109.  
  110.  
  111. /******************************************************************************
  112.  **                                                                             **
  113.  **                                    Hit data                                 **
  114.  **                                                                             **
  115.  *****************************************************************************/
  116.  
  117. typedef struct TQ3HitPath {
  118.     TQ3GroupObject            rootGroup;
  119.     unsigned long             depth;
  120.     TQ3GroupPosition        *positions;
  121. } TQ3HitPath;
  122.  
  123.  
  124. /******************************************************************************
  125.  **                                                                             **
  126.  **                                Pick class methods                             **
  127.  **                                                                             **
  128.  *****************************************************************************/
  129.  
  130. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Pick_GetType(
  131.     TQ3PickObject        pick);
  132.  
  133. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_GetData(
  134.     TQ3PickObject        pick,
  135.     TQ3PickData            *data);
  136.  
  137. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_SetData(
  138.     TQ3PickObject        pick,
  139.     const TQ3PickData    *data);
  140.     
  141. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_GetVertexTolerance(
  142.     TQ3PickObject        pick,
  143.     float                *vertexTolerance);
  144.     
  145. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_GetEdgeTolerance(
  146.     TQ3PickObject        pick,
  147.     float                *edgeTolerance);
  148.     
  149. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_SetVertexTolerance(
  150.     TQ3PickObject        pick,
  151.     float                vertexTolerance);
  152.     
  153. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_SetEdgeTolerance(
  154.     TQ3PickObject        pick,
  155.     float                edgeTolerance);
  156.  
  157. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_GetNumHits(
  158.     TQ3PickObject        pick,
  159.     unsigned long        *numHits);
  160.  
  161. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_EmptyHitList(
  162.     TQ3PickObject        pick);
  163.  
  164. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_GetPickDetailValidMask(
  165.     TQ3PickObject        pick,
  166.     unsigned long        index,
  167.     TQ3PickDetail        *pickDetailValidMask);
  168.  
  169. QD3D_EXPORT TQ3Status QD3D_CALL Q3Pick_GetPickDetailData(
  170.     TQ3PickObject        pick,
  171.     unsigned long        index,
  172.     TQ3PickDetail        pickDetailValue,
  173.     void                *detailData);
  174.  
  175. QD3D_EXPORT TQ3Status QD3D_CALL Q3HitPath_EmptyData(
  176.     TQ3HitPath            *hitPath);
  177.  
  178.     
  179. /******************************************************************************
  180.  **                                                                             **
  181.  **                            Window point pick methods                         **
  182.  **                                                                             **
  183.  *****************************************************************************/
  184.  
  185. QD3D_EXPORT TQ3PickObject QD3D_CALL Q3WindowPointPick_New(
  186.     const TQ3WindowPointPickData    *data);
  187.  
  188. QD3D_EXPORT TQ3Status QD3D_CALL Q3WindowPointPick_GetPoint(
  189.     TQ3PickObject                    pick,
  190.     TQ3Point2D                        *point);
  191.  
  192. QD3D_EXPORT TQ3Status QD3D_CALL Q3WindowPointPick_SetPoint(
  193.     TQ3PickObject                    pick,
  194.     const TQ3Point2D                *point);
  195.  
  196. QD3D_EXPORT TQ3Status QD3D_CALL Q3WindowPointPick_GetData(
  197.     TQ3PickObject                    pick,
  198.     TQ3WindowPointPickData            *data);
  199.  
  200. QD3D_EXPORT TQ3Status QD3D_CALL Q3WindowPointPick_SetData(
  201.     TQ3PickObject                    pick,
  202.     const TQ3WindowPointPickData    *data);
  203.  
  204.  
  205. /******************************************************************************
  206.  **                                                                             **
  207.  **                            Window rect pick methods                         **
  208.  **                                                                             **
  209.  *****************************************************************************/
  210.  
  211. QD3D_EXPORT TQ3PickObject QD3D_CALL Q3WindowRectPick_New(
  212.     const TQ3WindowRectPickData    *data);
  213.  
  214. QD3D_EXPORT TQ3Status QD3D_CALL Q3WindowRectPick_GetRect(
  215.     TQ3PickObject                pick,
  216.     TQ3Area                        *rect);
  217.  
  218. QD3D_EXPORT TQ3Status QD3D_CALL Q3WindowRectPick_SetRect(
  219.     TQ3PickObject                pick,
  220.     const TQ3Area                *rect);
  221.  
  222. QD3D_EXPORT TQ3Status QD3D_CALL Q3WindowRectPick_GetData(
  223.     TQ3PickObject                pick,
  224.     TQ3WindowRectPickData        *data);
  225.  
  226. QD3D_EXPORT TQ3Status QD3D_CALL Q3WindowRectPick_SetData(
  227.     TQ3PickObject                pick,
  228.     const TQ3WindowRectPickData    *data);
  229.  
  230.  
  231.  
  232.  
  233. /******************************************************************************
  234.  **                                                                             **
  235.  **                                Shape Part methods                             **
  236.  **                                                                             **
  237.  *****************************************************************************/
  238.  
  239. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3ShapePart_GetType(
  240.     TQ3ShapePartObject            shapePartObject);
  241.  
  242. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3MeshPart_GetType(
  243.     TQ3MeshPartObject            meshPartObject);
  244.  
  245. QD3D_EXPORT TQ3Status QD3D_CALL Q3ShapePart_GetShape(
  246.     TQ3ShapePartObject            shapePartObject,
  247.     TQ3ShapeObject                *shapeObject);
  248.  
  249. QD3D_EXPORT TQ3Status QD3D_CALL Q3MeshPart_GetComponent(
  250.     TQ3MeshPartObject            meshPartObject,
  251.     TQ3MeshComponent            *component);
  252.  
  253. QD3D_EXPORT TQ3Status QD3D_CALL Q3MeshFacePart_GetFace(
  254.     TQ3MeshFacePartObject        meshFacePartObject,
  255.     TQ3MeshFace                    *face);
  256.  
  257. QD3D_EXPORT TQ3Status QD3D_CALL Q3MeshEdgePart_GetEdge(
  258.     TQ3MeshEdgePartObject        meshEdgePartObject,
  259.     TQ3MeshEdge                    *edge);
  260.  
  261. QD3D_EXPORT TQ3Status QD3D_CALL Q3MeshVertexPart_GetVertex(
  262.     TQ3MeshVertexPartObject        meshVertexPartObject,
  263.     TQ3MeshVertex                *vertex);
  264.  
  265. #ifdef __cplusplus
  266. }
  267. #endif  /*  __cplusplus  */
  268.  
  269. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  270.  
  271. #if defined(__xlc__) || defined(__XLC121__)
  272.     #pragma options enum=reset
  273.     #pragma options align=reset
  274. #elif defined(__MWERKS__)
  275.     #pragma enumsalwaysint reset
  276.     #pragma options align=reset
  277. #elif defined(__MRC__) || defined(__SC__)
  278.     #if PRAGMA_ENUM_RESET_QD3DPICK
  279.         #pragma options(pack_enums)
  280.         #undef PRAGMA_ENUM_RESET_QD3DPICK
  281.     #endif
  282.     #pragma options align=reset
  283. #endif
  284.  
  285. #endif  /* OS_MACINTOSH */
  286.  
  287. #endif  /*  QD3DPick_h  */
  288.